#!/usr/bin/env python
from django.contrib.auth import login, authenticate
from . import models


def login_auth(request):
    uname = request.POST['username']
    passwd = request.POST['password']
    user = authenticate(username=uname, password=passwd)
    if user is not None:
        login(request, user)
        return True
    else:
        return False